<html>
<head>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
    body {
        direction: rtl;
        margin: 0px;
        background-color: red;
    }

    .positioned {
        position: fixed;
        top: 50px;
        left: 50px;
        width: 100px;
        height: 100px;
    }

    .indicator {
        background-color: red;
    }

    .layer {
        will-change:transform;
        background-color: green;
    }

    #root {
        width: 1000px;
        height: 1000px;
        background-color: white;
    }

    #layertree {
        position: absolute;
        top: 10000px;
        left: 0px;
    }
</style>
<script>
    function doTest() {
        if (window.testRunner) {
            testRunner.waitUntilDone();
            testRunner.dumpAsTextWithPixelResults();
        }

        // The far left coordinate of the document varies by window width.
        var offset = document.body.clientWidth - document.scrollingElement.scrollWidth + 1;

        window.setTimeout(function() {
            window.scrollTo(offset, 0);
            if (window.testRunner && window.internals) {
                runAfterLayoutAndPaint(function() {
                    if (top == self)
                        testRunner.setCustomTextOutput(internals.layerTreeAsText(document));
                    testRunner.notifyDone();
                });
            }
        }, 0);
    }
    window.addEventListener('load', doTest, false);
</script>
<body>
    <div id="root"></div>
    <div class="positioned indicator"></div>
    <div class="positioned layer"></div>
</body>
</html>
